// 定义枚举类型
enum Direction {
    Up,
    Down,
    Left,
    Right
}

// 使用枚举类型
let up: Direction = Direction.Up
console.log(up)


// 定义字符串枚举类型
enum DirectionStr {
    Up = "UP",
    Down = "DOWN",
    Left = "LEFT",
    Right = "RIGHT"
}

// 使用字符串枚举类型
function changeDirection(direction: DirectionStr) {
    console.log(direction);   
}
let left:DirectionStr = DirectionStr.Left 
changeDirection(DirectionStr.Up)
changeDirection(DirectionStr.Down)
changeDirection(left)